<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <input type="text" placeholder="请输入1-100之间的整数" v-model="num">
    <input type="button" value="猜一猜" @click="f()">
    <h1>{{info}}</h1>
</div>
<script src="js/vue.min.js"></script>
<script >
    let i = parseInt(Math.random()*100)+1
    let v = new Vue({
        el:"body>div",
        data:{
          num:"",
          info:""
        },
        methods:{
            f() {
               if (i>v.num){
                   v.info="小了"
               } else if (i<v.num){
                   v.info="大了"
               }else{
                   v.info="猜对了"
               }
            }
        }
    })
</script>
</body>
</html>